import {UserEntity} from '../src/entity/user.entity';
import {ApplyDeviceEntity} from '../src/entity/apply.device.entity';
import {ApplyCategoryEntity} from '../src/entity/apply.category.entity';
import {ApplyUserEntity} from '../src/entity/apply.user.entity';
import {ApplyFlyerEntity} from '../src/entity/apply.flyer.entity';
import {ApproveEntity} from '../src/entity/approve.entity';
import {ApplyEntity} from '../src/entity/apply.entity';
import {EventCategoryEntity} from '../src/entity/event.category.entity';
import {EventTypeEntity} from '../src/entity/event.type.entity';
import {LogListEntity} from '../src/entity/log.list.entity';
// import {UserListEntity} from '../src/entity/user.list.entity';
let domain = 'http://122.226.24.62:10010';
const globalApiPrefix = '/gate/nd';
let redisAddress = '127.0.0.1:6379:';
let mysqlConfig = {
    host: '127.0.0.1',
    port: 3306,
    username: 'root',
    password: '123456',
}
let mysqlDatabase = 'dji_cloud_v2';// v1版本是cloud_sample
let apiPrefix = 'api/as/v2';// v1 版本是api/v1
let wsUrl = `ws://60.163.159.174:6789/${apiPrefix}/ws?x-auth-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ3b3Jrc3BhY2VfaWQiOiIxNGZlOGNiMi1lMzU5LTQzMzMtODBmZC1kYjNhMDUwMjhjYzIiLCJzdWIiOiJDbG91ZEFwaVNhbXBsZSIsInVzZXJfdHlwZSI6IjEiLCJuYmYiOjE3MDU5NzIxNTgsImxvZyI6IkxvZ2dlcltjb20uZGppLmNsb3VkLmNvbW1vbi5tb2RlbC5DdXN0b21DbGFpbV0iLCJpc3MiOiJESkkiLCJpZCI6IjQzMTE5NmY5LWZmYzAtNGYwNS05NDI5LWJlNGU2YmRiZDA5OCIsImV4cCI6MTc5MjM3MjE1OCwiaWF0IjoxNzA1OTcyMTU4LCJ1c2VybmFtZSI6Inpzd3JqIn0.7PT_jt4xEjzKAWqNUBahJzHx5LU3k33SJjUq9oUoiLk`
let dingDingDomain = 'https://open.on-premises.dingtalk.com'
let dingDingAppKey = 'wrj_apply-0dH1SxxHM64u7pfq6VNn'
let dingDingAppSecret = 'Phz88oQ1ts9XvyAdt0YPQjfm0dHt97s02nkAtCL6'
let isHailai = true; // 是否是岱山低空海莱项目
let env = 'local'
// let env = 'prod'
if (env === 'dev') {
    domain = 'http://localhost:6789';
    mysqlConfig = {
        host: '111.229.239.187',// 腾讯云
        port: 3609,
        username: 'root',
        password: 'huangqinghua@123!@',
    }
    redisAddress = '111.229.239.187:6388:'
}
if (env === 'prod') {
    domain = 'http://localhost:6789';
    dingDingDomain = 'https://openplatform-pro.ding.zj.gov.cn';
    dingDingAppKey = 'wrj_apply-MWA1Ri2Q32gSh0NnUJfq';
    dingDingAppSecret = '6TdvktigdGk8u11rs5Otkf054WtnL3e9fRf653oL';
    mysqlConfig = {
        host: 'localhost',
        port: 3306,
        username: 'root',
        password: 'root',// 岱山和新城和市公安都是root，其它是Ptdx@123++
    }
    redisAddress = '127.0.0.1:6379:Ptdx@123'
    if (isHailai) {
        mysqlDatabase = 'hydkdb'
        mysqlConfig = {
            host: 'pc-t5e0z4v463h9jk1rc.mysql.polardb.rds.ops.domain-hilai.com',
            port: 3366,
            username: 'hydkjj',
            password: 'Dsxhydk@240802#$',
        }
        // redisAddress = 'r-t5e59766faa9ed54.redis.rds.ops.domain-hilai.com:6379:Dsxhydk@240802#$:r-t5e59766faa9ed54'
        redisAddress = 'r-t5e59766faa9ed54.redis.rds.ops.domain-hilai.com:6379:Dsxhydk@240802#$'
    }

}
export default {
    GlobalApiPrefix: globalApiPrefix,
    WsUrl: wsUrl,
    ApiPrefix:apiPrefix,
    MaxPwdErrorCount: 5,
    PwdErrorTimeout: 600,//错误次数锁定时间，单位秒
    AdminUserName: 'zswrj',
    ServerDomain: domain,
    ErrorCountPrefix: '_error_count_',
    Redis: [redisAddress],
    Mysql: {
        ...mysqlConfig,
        database: mysqlDatabase,
        entities: [UserEntity, ApplyDeviceEntity, ApplyCategoryEntity, ApplyUserEntity, ApplyFlyerEntity, ApproveEntity, ApplyEntity, EventCategoryEntity, EventTypeEntity, LogListEntity],
        synchronize: true, // 是否自动将实体类同步到数据库
    },
    DingDing: {
        Domain: dingDingDomain,// 浙政钉 https://openplatform-pro.ding.zj.gov.cn  专有钉钉 https://open.on-premises.dingtalk.com
        AppKey: dingDingAppKey,
        AppSecret: dingDingAppSecret,
        AccessTokenKey: '_wrj_apply_access_token',// 专有钉钉后台接口access_token
        AdminAccessTokenKey: '_wrj_apply_admin_token', // 无人机申请后台管理access_token
        MiniProgramTokenKey: '_mini_program_token',// 小程序
    },
    // 排除token认证的接口路径数组
    AuthExternal: [
        globalApiPrefix + '/user/login',
        globalApiPrefix + '/user/unlock',
        globalApiPrefix + '/user-list/list',
        globalApiPrefix + '/user-list/save',
        globalApiPrefix + '/log/save',
        globalApiPrefix + '/log/list',
        globalApiPrefix + '/apply-admin/login/login',
        globalApiPrefix + '/ding-auth/gettoken',
        globalApiPrefix + '/ding-auth/getuser',
        globalApiPrefix + '/event/create-category',
        globalApiPrefix + '/event/create-event-type',
        globalApiPrefix + '/event/edit-category',
        globalApiPrefix + '/event/edit-event-type',
        globalApiPrefix + '/event/edit-category-status',
        globalApiPrefix + '/event/edit-event-type-status',
        globalApiPrefix + '/event/del-event-category',
        globalApiPrefix + '/event/del-event-type',
        globalApiPrefix + '/event/list',

    ],

}
